﻿//
//  Copyright (c) 2011 Extreme: Paweł Huryn (lead), Jakub Domański
//

using System;
using System.Collections.Generic;

namespace Extreme.SPFramework.DomainModel
{
    /// <summary>
    /// Base repository interface
    /// </summary>
    /// <typeparam name="T">Type of entity</typeparam>
    public interface IRepository<T>
     where T : EntityBase, new()
    {
        /// <summary>
        /// Gets all items
        /// </summary>
        /// <returns></returns>
        List<T> GetAllItems();

        /// <summary>
        /// gets item by unique id
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Entity</returns>
        T GetItem(Guid id);

        /// <summary>
        /// Gets item by id
        /// </summary>
        /// <param name="id">Identifier</param>
        /// <returns>Entity</returns>
        T GetItem(int id);

        /// <summary>
        /// Saves item
        /// </summary>
        /// <param name="entity">Entity</param>
        void SaveItem(T entity);

        /// <summary>
        /// Deletes item
        /// </summary>
        /// <param name="id">Item identifier</param>
        void DeleteItem(int id);

        /// <summary>
        /// Deletes item
        /// </summary>
        /// <param name="id">Item idenditier</param>
        void DeleteItem(Guid id);

        /// <summary>
        /// Gets all items by id dictionary
        /// </summary>
        Dictionary<int, T> GetAllItemsByIdDictionary();

        /// <summary>
        /// Gets all items by guid dictionary
        /// </summary>
        Dictionary<Guid, T> GetAllItemsByUniqueIdDictionary();
    }
}
